local joyex__guicai = fk.CreateSkill {

  name = "joyex__guicai",

  tags = {  },

}



joyex__guicai:addEffect(fk.AskForRetrial, {
  name = "joyex__guicai",
  anim_type = "control",
  events = {fk.AskForRetrial},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(joyex__guicai.name) and not player:isNude()
  end,
  on_cost = function(self, event, target, player, data)
    local card = player.room:askForResponse(player, joyex__guicai.name, ".|.|.|hand,equip|.|", "#joyex__guicai-ask::" .. target.id .. ":" .. data.reason, true)
    if card ~= nil then
      event:setCostData(self, card)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:retrial(event:getCostData(self), player, data, joyex__guicai.name)
    if player.dead then return end
    if event:getCostData(self).suit == Card.Club then
      player:drawCards(2, joyex__guicai.name)
    elseif event:getCostData(self).suit == Card.Heart and player:isWounded() then
      player.room:recover({
      who = player,
      num = 1,
      recoverBy = player,
      skillName = joyex__guicai.name
      })
    end
  end,
})

return joyex__guicai